import Vue from 'vue'
import Router from 'vue-router'
import ElementUI from 'element-ui'
import '../assets/theme/index.css'

import { library } from '@fortawesome/fontawesome-svg-core'
import { fas } from '@fortawesome/free-solid-svg-icons'
import { far } from '@fortawesome/free-regular-svg-icons'
import { fab } from '@fortawesome/free-brands-svg-icons'
import {
  FontAwesomeIcon,
  FontAwesomeLayers,
  FontAwesomeLayersText
} from '@fortawesome/vue-fontawesome'

import NotFound from '@/templates/NotFound.vue'
import Index from '@/templates/Index/Index.vue'

import LayoutLogin from '@/templates/LayoutLogin.vue'
import Login from '@/templates/Login.vue'
import register from '@/templates/register.vue'

import LayoutMain from '@/templates/LayoutMain.vue'

import Example from '@/templates/Example.vue'

// 教学平台  start
import teachManageList from '@/templates/teachPlaltform/teachManage/list.vue'
import pathLearn from '@/templates/teachPlaltform/pathLearn/index.vue'
import userList from '@/templates/teachPlaltform/user/list.vue'  //selfTest
import selfTest from '@/templates/teachPlaltform/selfTest/index.vue'  //selfTest
import studentLearn from '@/templates/teachPlaltform/studentLearn/studentLearn.vue'  //学生教材
import studentLearnDetail from '@/templates/teachPlaltform/studentLearn/studentLearnDetail.vue'  //学生教材详情
import simulationExamList from '@/templates/teachPlaltform/simulationExam/simulationExamList.vue'  //全真模拟试卷列表
import simulationExamDetail from '@/templates/teachPlaltform/simulationExam/simulationExamDetail.vue'  //全真模拟试卷详情
import coursewareLearnDetail from '@/templates/teachPlaltform/studentLearn/coursewareLearnDetail.vue'  //课件学习详情
import myNote from '@/templates/teachPlaltform/myNote/index.vue'//我的笔记
import myCollection from '@/templates/teachPlaltform/myCollection/index.vue'//我的收藏
import mistakesCollection from '@/templates/teachPlaltform/mistakesCollection/index.vue'//我的错题集

//simulationExamDetail
//  教学平台  end
// 个人信息编辑
const EditPersonalInfo = () => import('@/templates/Other/EditPersonalInfo.vue')
const ChangePassword = () => import('@/templates/Other/ChangePassword.vue')


//杜彦召新加页面结束
const Viewer = () => import('@/templates/Viewer.vue')
const shareViewer = () => import('@/templates/share/viewer.vue')

library.add(fas, far, fab)
Vue.component('font-awesome-icon', FontAwesomeIcon)
Vue.component('font-awesome-layers', FontAwesomeLayers)
Vue.component('font-awesome-layers-text', FontAwesomeLayersText)
Vue.use(Router)
Vue.use(ElementUI)

const router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: '/Login'
    },
    {
      path: '/index',
      name: 'index',
      component: Index
    },

    {
      path: '/viewer',
      name: 'Viewer',
      component: Viewer
    },

    {
      path: '/shareViewer',
      name: 'shareViewer',
      component: shareViewer
    },
    //杜彦召新加路由结束

    // 教学平台  start
    //教学库管理
    {
      path: '/teachManageList',
      name: 'teachManageList',
      component: teachManageList
    },
    //病例学习
    {
      path: '/pathLearn',
      name: 'pathLearn',
      component: pathLearn
    },
    //用户管理
    {
      path: '/user',
      name: 'user',
      component: userList
    },
    //自我考试
    {
      path: '/selfTest',
      name: 'selfTest',
      component: selfTest
    },
     //教材学习
     {
      path: '/studentLearn',
      name: 'studentLearn',
      component: studentLearn
    },
    //教材详情
    {
      path: '/studentLearnDetail',
      name: 'studentLearnDetail',
      component: studentLearnDetail
    },

    //全真模拟  simulationExamList
    {
      path: '/simulationExamList',
      name: 'simulationExamList',
      component: simulationExamList
    },
    //全真模拟详情  simulationExamDetail
    {
      path: '/simulationExamDetail',
      name: 'simulationExamDetail',
      component:simulationExamDetail
    },
    //课件学习详情
    {
      path: '/coursewareLearnDetail',
      name: 'coursewareLearnDetail',
      component:coursewareLearnDetail
    },
    //myNote 我的笔记
    {
      path: '/myNote',
      name: 'myNote',
      component:myNote
    },
     //myCollection 我的收藏
     {
      path: '/myCollection',
      name: 'myCollection',
      component:myCollection
    },
     //mistakesCollection 我的错题集
     {
      path: '/mistakesCollection',
      name: 'mistakesCollection',
      component:mistakesCollection
    },
    //教学平台  end 
    {
      path: '/LayoutLogin',
      component: LayoutLogin,
      children: [
        {
          path: '/login',
          name: 'Login',
          component: Login
        },
        {
          path: '/register',
          name: 'register',
          component: register
        }
      ]
    },

    {
      path: '/layout-main',
      component: LayoutMain,
      children: [
        {
          path: '/example',
          name: 'Example',
          component: Example
        },
        {
          path: '/editPersonalInfo',
          name: 'EditPersonalInfo',
          component: EditPersonalInfo
        },
        {
          path: '/ChangePassword',
          name: 'ChangePassword',
          component: ChangePassword
        },

      ]
    },
    {
      path: '*',
      component: NotFound
    }
  ],
  scrollBehavior() {
    return { x: 0, y: 0 }
  }
})

// router.addRoutes(user)

export default router
